package com.oimchat.server.general.kernel.work.module.business.chat;

import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author: xchb
 * @date: 2021/4/28 16:38
 * @description:
 */
public class PatternDemo {

    public static void main(String[] args) {

        String address = "银湖路2号金碧苑别墅3栋1501";

        Object[] result = pattern1(address);

        System.out.println(Arrays.toString(result));
    }

    public static Object[] pattern1(String src) {

        Object[] result = null;

        Pattern pattern = Pattern.compile("\\d+栋\\d+");

        Matcher matcher = pattern.matcher(src);

        while (matcher.find()){
            result = matcher.group().split("栋");
        }

        return result;
    }
}
